package sg.edu.nus.iss.billing.model.subscription;

import java.util.ArrayList;
import java.util.Calendar;

import sg.edu.nus.iss.billing.controller.ChargeController.Charges;
import sg.edu.nus.iss.billing.model.calculation.PerDay;
import sg.edu.nus.iss.billing.model.calculation.PerMonth;
import sg.edu.nus.iss.billing.model.calculation.PerTransaction;
import sg.edu.nus.iss.billing.model.charge.IChargable;
import sg.edu.nus.iss.billing.model.charge.Rate;
import sg.edu.nus.iss.billing.model.charge.SubscriptionFee;
import sg.edu.nus.iss.billing.model.charge.UsageFee;

/**
 * @author Yeo Hee Ling, BeeHong, EngKhoon
 *
 */
public class MockedServices {

	static Calendar c;
	static {
		c = Calendar.getInstance();
		c.set(2011, 1, 1);
	}

	public static ISubscribable AddtionalChannel1() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable addtionalChannel1 = new Service("cAdditionalChannels");
		addtionalChannel1.setDateCommenced("10-Oct-2010");
		addtionalChannel1.setDateTerminated("20-Oct-2010");
		IChargable subscriptionFeeESPN = new SubscriptionFee(addtionalChannel1,
				Charges.AdditionalChSubscriptionCharge.toString());
		subscriptionFeeESPN.setRate(new Rate(2.20, c.getTime()));
		subscriptionFeeESPN.setChargeMethod(new PerDay());
		charges.add(subscriptionFeeESPN);
		
		IChargable subscriptionFeeNHK = new SubscriptionFee(addtionalChannel1,
				Charges.AdditionalChSubscriptionCharge.toString());
		subscriptionFeeNHK.setRate(new Rate(2.20, c.getTime()));
		subscriptionFeeNHK.setChargeMethod(new PerDay());
		charges.add(subscriptionFeeNHK);
		
		IChargable subscriptionFeeCNA = new SubscriptionFee(addtionalChannel1,
				Charges.AdditionalChSubscriptionCharge.toString());
		subscriptionFeeCNA.setRate(new Rate(2.20, c.getTime()));
		subscriptionFeeCNA.setChargeMethod(new PerDay());
		charges.add(subscriptionFeeCNA);
		
		
		addtionalChannel1.setCharges(charges);
		return addtionalChannel1;
	}

	public static ISubscribable AddtionalChannel2() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable addtionalChannel2 = new Service("cAdditionalChannels");
		addtionalChannel2.setDateCommenced("20-Oct-2010");

		IChargable subscriptionFeeCNN = new SubscriptionFee(addtionalChannel2,
				Charges.AdditionalChSubscriptionCharge.toString());
		subscriptionFeeCNN.setRate(new Rate(2.20, c.getTime()));
		subscriptionFeeCNN.setChargeMethod(new PerDay());
		charges.add(subscriptionFeeCNN);
		
		IChargable subscriptionFeeBBC = new SubscriptionFee(addtionalChannel2,
				Charges.AdditionalChSubscriptionCharge.toString());
		subscriptionFeeBBC.setRate(new Rate(2.20, c.getTime()));
		subscriptionFeeBBC.setChargeMethod(new PerDay());
		charges.add(subscriptionFeeBBC);
		
		addtionalChannel2.setCharges(charges);
		return addtionalChannel2;
	}

	public static ISubscribable BasicCableTVService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable cableTVService = new Service("cStandard");
		cableTVService.setDateCommenced("10-Oct-2010");
		IChargable subscriptionFee = new SubscriptionFee(cableTVService, Charges.CableTVSubscriptionCharge.toString());// per
		// month
		subscriptionFee.setRate(new Rate(5.25, c.getTime()));// actually from the property file
		subscriptionFee.setChargeMethod(new PerMonth());
		charges.add(subscriptionFee);
		cableTVService.setCharges(charges);

		return cableTVService;
	}

	public static ISubscribable DigitalCallTransferService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable digitalCallTransferService = new Service("dCallTransfer");
		digitalCallTransferService.setDateCommenced("10-Oct-2010");
		IChargable subscriptionFee = new SubscriptionFee(digitalCallTransferService,
				Charges.DigitalCallTransferSubscriptionCharge.toString());// per month
		subscriptionFee.setRate(new Rate(2.25, c.getTime()));// actually from the property file
		subscriptionFee.setChargeMethod(new PerDay());
		charges.add(subscriptionFee);
		digitalCallTransferService.setCharges(charges);
		return digitalCallTransferService;
	}

	public static ISubscribable DigitalIDDService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable digitalIDDService = new Service("dIDD");
		digitalIDDService.setDateCommenced("10-Oct-2010");
		IChargable usageFee = new UsageFee(digitalIDDService, Charges.DigitalIDDUsageCharge.toString());// per
																										// transaction
		usageFee.setRate(new Rate(0.15, c.getTime()));// actually from the property file
		usageFee.setChargeMethod(new PerTransaction());
		charges.add(usageFee);
		digitalIDDService.setCharges(charges);
		return digitalIDDService;
	}

	public static ISubscribable DigitalPhoneService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable digitalPhoneService = new Service("dLocal");
		digitalPhoneService.setDateCommenced("10-Oct-2010");
		IChargable subscriptionFee = new SubscriptionFee(digitalPhoneService,
				Charges.DigitalLineSubscriptionCharge.toString());// per month
		subscriptionFee.setRate(new Rate(22.5, c.getTime()));// actually from the property file
		subscriptionFee.setChargeMethod(new PerDay());
		charges.add(subscriptionFee);
		digitalPhoneService.setCharges(charges);

		return digitalPhoneService;
	}

	public static ISubscribable MobileBasicService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable mobileService = new Service("mLocal");
		mobileService.setDateCommenced("10-Oct-2010");
		IChargable subscriptionFee = new SubscriptionFee(mobileService, Charges.MobileLineSubscriptionCharge.toString());// per
		// month
		subscriptionFee.setRate(new Rate(10.10, c.getTime()));// actually from the property file
		subscriptionFee.setChargeMethod(new PerDay());
		charges.add(subscriptionFee);
		mobileService.setCharges(charges);
		return mobileService;
	}

	public static ISubscribable MobileIDDService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable mobileIDDService = new Service("mIDD");
		mobileIDDService.setDateCommenced("10-Oct-2010");
		IChargable usageFee = new UsageFee(mobileIDDService, Charges.MobileIDDUsageCharge.toString());// per transaction
		usageFee.setRate(new Rate(0.85, c.getTime()));// actually from the property file
		usageFee.setChargeMethod(new PerTransaction());
		charges.add(usageFee);
		mobileIDDService.setCharges(charges);
		return mobileIDDService;
	}

	public static ISubscribable MobileRoamingService() {
		ArrayList<IChargable> charges = new ArrayList<IChargable>();
		ISubscribable mobileRoamingService = new Service("mRoaming");
		mobileRoamingService.setDateCommenced("10-Oct-2010");
		IChargable subscriptionFee = new SubscriptionFee(mobileRoamingService,
				Charges.mobileRoamingSubscriptionCharge.toString());// per
		// month
		subscriptionFee.setRate(new Rate(5.25, c.getTime()));// actually from the property file
		subscriptionFee.setChargeMethod(new PerDay());

		IChargable usageFee = new UsageFee(mobileRoamingService, Charges.mobileRoamingUsageCharge.toString());// per
																												// transaction
		usageFee.setRate(new Rate(0.35, c.getTime()));// actually from the property file
		usageFee.setChargeMethod(new PerTransaction());
		charges.add(subscriptionFee);
		charges.add(usageFee);
		mobileRoamingService.setCharges(charges);
		return mobileRoamingService;
	}
}
